package com.example.mapper;

import com.example.pojo.Author;
import com.example.pojo.AuthorQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

//操作员工基本信息
@Mapper
public interface AuthorMapper {
     //@Select("select e.*,d.name deptName from emp e left join dept d on e.dept_id =d.id order by e.update_time desc")
    public List<Author> list(AuthorQueryParam authorQueryParam);

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into blog_system.authors(name,gender,phone,email,bio,image," +
            "entry_date,create_time,update_time) values (#{name},#{gender},#{phone},#{email},#{bio},#{image}," +
            "#{entryDate},#{createTime},#{updateTime})")
    void innsert(Author emp);

    void deleteByIds(List<Integer> ids);

    @Select(" select * from blog_system.authors where id=#{id}")
    Author getById(Integer id);

    void update(Author emp);
    //条件查询员工
    @MapKey("pos")
    List<Map<String, Object>> coutEmpJobData();

    List<Map<String, Object>> coutEmpGenderData();
    @Select("select id ,username,password,name,gender,phone,job,salary,image,entry_date," +
            "dept_id,create_time,update_time from emp")
    List<Author> showAll();

}
